
package com.hexinfo.dmpro.sparing.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hexinfo.dmpro.common.utils.CommonConstants;
import com.hexinfo.dmpro.sparing.model.HotSpareDele;
import com.hexinfo.dmpro.sparing.dao.HotSpareDeleMapper;
import com.hexinfo.dmpro.sparing.service.HotSpareDeleService;
import org.springframework.stereotype.Service;

/**
 * 热备删除表
 *
 * @author yemw
 * @date 2023-11-20 14:47:20
 */
@Service
public class HotSpareDeleServiceImpl extends ServiceImpl<HotSpareDeleMapper, HotSpareDele> implements HotSpareDeleService {

    @Override
    public Page queryList(Page page, HotSpareDele hotSpareDele) {
        LambdaQueryWrapper<HotSpareDele> wrapper = Wrappers.lambdaQuery();
        wrapper.like(StrUtil.isNotBlank(hotSpareDele.getSourceName()),HotSpareDele::getSourceName,hotSpareDele.getSourceName())
               .like(StrUtil.isNotBlank(hotSpareDele.getLibraryTableName()),HotSpareDele::getLibraryTableName,hotSpareDele.getLibraryTableName())
                .eq(StrUtil.isNotBlank(hotSpareDele.getDeleType()),HotSpareDele::getDeleType,hotSpareDele.getDeleType())
                .eq(StrUtil.isNotBlank(hotSpareDele.getDeleState()),HotSpareDele::getDeleState,hotSpareDele.getDeleState())
                .eq(HotSpareDele::getDel,CommonConstants.STATUS_NORMAL).orderByDesc(HotSpareDele::getCreateTime);
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }
}
